#include <iostream>
#include <math.h>
using namespace std;

typedef long long LL;

bool is_prime(LL n)
{
    if (n < 2) return false;
    for (int i = 2; i <= sqrt(n); i++)
    {
        if (n % i == 0) return false;
    }
    return true;
}
int main()
{
    int t;
    cin >> t;
    LL a, b;
    while (t--)
    {
        cin >> a >> b;
        if ((a == 1 && is_prime(b)) || (b == 1) && is_prime(a))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;


const int N = 2e5 + 10;

int n, k;
int arr[N];
int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    int left = 0, right = 0, ret = 1;
    while (right < n)
    {
        while (arr[right] - arr[left] > k)
        {
            left++;
        }
        ret = max(ret, right - left + 1);
        right++;
    }
    cout << ret << endl;
    return 0;
}